package com.dongchedi.utils;

import com.dongchedi.entity.CustomerLogin;
import org.springframework.stereotype.Component;

@Component
public class HostHolder {

	/**
	 * 线程隔离
	 */
	private ThreadLocal<CustomerLogin> users = new ThreadLocal<>();

	public void setUser(CustomerLogin customerLogin) {
		users.set(customerLogin);
	}

	public CustomerLogin getUser() {
		return users.get();
	}

	public void clear() {
		users.remove();
	}
}
